from datetime import datetime
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from applications.exts import db


#     用户优惠卷
class CouponUser(db.Model,UserMixin):
    __tablename__ = 'wx_user_coupon'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    openid=db.Column(db.String(30),db.ForeignKey('wx_user.openid'),nullable=False,comment='用户的外建')
    coupon_sn=db.Column(db.String(99),db.ForeignKey('wx_coupon.coupon_sn'),nullable=False, comment='优惠卷编号')
    status=db.Column(db.Integer,default=0,comment='优惠卷状态，0可用，1已使用，2过期')
    add_time=db.Column(db.DateTime,default=datetime.now(),comment='领取优惠卷的时间')

